package Thread;

import java.util.Scanner;

public class Demo6 {
    private static volatile int n=0;

    public static void main(String[] args) {
        Thread thread=new Thread(()->{
            while (n==0){

            }
            System.out.println("thread结束");
        });
        Thread thread1=new Thread(()->{
            Scanner scanner=new Scanner(System.in);
            System.out.println("输入一个整数:");
            n=scanner.nextInt();
        });
        thread.start();
        thread1.start();
    }
}
